using System.Collections.ObjectModel;
using ImageCSharp.Core.Models;

namespace ImageCSharp.Core.Interfaces
{
    /// <summary>
    /// 历史记录服务接口
    /// </summary>
    public interface IHistoryService
    {
        /// <summary>
        /// 添加历史记录项
        /// </summary>
        void AddHistoryItem(string action, ImageDocument state);

        /// <summary>
        /// 撤销操作
        /// </summary>
        bool Undo();

        /// <summary>
        /// 重做操作
        /// </summary>
        bool Redo();

        /// <summary>
        /// 获取历史记录列表
        /// </summary>
        ObservableCollection<HistoryItem> GetHistory();

        /// <summary>
        /// 清除历史记录
        /// </summary>
        void Clear();

        /// <summary>
        /// 是否可以撤销
        /// </summary>
        bool CanUndo { get; }

        /// <summary>
        /// 是否可以重做
        /// </summary>
        bool CanRedo { get; }
    }

    /// <summary>
    /// 历史记录项
    /// </summary>
    public class HistoryItem
    {
        public string Action { get; set; } = string.Empty;
        public DateTime Timestamp { get; set; }
        public ImageDocument State { get; set; }
        public string Icon { get; set; } = "Help";
        public bool IsActive { get; set; }
        
        public string Name => Action;
        public string TimeString => Timestamp.ToString("HH:mm:ss");
    }
}